<?php
/**
 * Created by PhpStorm.
 * User: liuxiaojie
 * Date: 2019-03-08
 * Time: 22:02
 */


namespace app\api\controller;

use app\common\Base;

class Common extends Base{

    // 职位
    function category(){

        $result = db('job_category')->where(['status'=> 1])->field('id, name')->select();

        $result = array_merge([[
            'id'=> 0,
            'name'=> '不限'
        ]], $result);

        return success($result);
    }

    // 薪资范围
    function pay(){

        $result = db('job_pay')->where(['status'=> 1])->field('id, name')->select();

        $result = array_merge([[
            'id'=> 0,
            'name'=> '不限'
        ]], $result);

        return success($result);
    }

    function code2img(){

        $code = $this->getParam('code', '');

        $url = db('promo_code')->where(['code'=> $code])->value('img');

        return success(['url'=> config("host").$url]);

    }

    // 获取商家类型
    function company_type(){

        $list = db('company_type')->where(['status'=> 1])->field('id, name')->select();

        return success($list);
    }

}